package BanyuanClub.Work.Day0223.GongJu;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

public class TextMath {
    public static void main(String[] args) {
        double[] arr = {0.1,0.2,0.3,0.6,0.5};
        BigDecimal s = new BigDecimal("0");
        BigDecimal j = new BigDecimal("1");
        for (double d:arr){
            BigDecimal bd = new BigDecimal(d + "");
            s = s.add(bd);
            j = j.multiply(bd);
        }
        System.out.println(s);
        System.out.println(j);

        double[] darr = {12.23, 22.1, 8.88, 55.5, 33.78};
        int[] iarr = new int[darr.length];
        for (int i = 0; i < darr.length; i++) {
//            long r = Math.round(darr[i]);
//            iarr[i] = (int) r;
            iarr[i] = (int)Math.round(darr[i]);
        }
        Arrays.sort(iarr);
        System.out.println(Arrays.toString(iarr));

        int[] narr = new int[10];
        int max = 0;
        for (int i = 0; i < 10; i++) {
            narr[i] = (int)(Math.random()*2016+1);
            if(max < narr[i])
                max = narr[i];
        }
        System.out.println(Arrays.toString(narr));
        System.out.println(max);
        Scanner pu = new Scanner(System.in);
        while (true){
            int c = pu.nextInt();
            if(c == max) {
                System.out.println("猜中了");
                break;
            }else if(c < max){
                System.out.println("猜小了");
            }else {
                System.out.println("猜大了");
            }
        }
    }
}
